<ul class="submenu">
<?php if($this->Session->read('Auth.User.role') === 'superadmin'): ?>
	<li><?php echo $this->Html->link('New user',array('action' => 'add')); ?></li>
<?php endif; ?>

<?php if($this->Session->read('Auth.User.role') === 'admin'): ?>
	<li><?php echo $this->Html->link('Holidays',array('controller' => 'holidays', 'action' => 'index')); ?></li>
<?php endif; ?>

</ul>

<?php
/*echo '<pre>';
print_r($users);
echo '</pre>';*/

 ?>
Pages >> <?php echo $this->Paginator->numbers(array('first' => 'First page')); ?>
<table>
    <tr>
        <th>Id</th>
        <th>Email</th>
        <th>State</th>
        <th>Action</th>
        <th>Role</th>
        <th>Modified</th>
        <th>Created</th>
    </tr>

    <!-- Here is where we loop through our $posts array, printing out post info -->

    <?php foreach ($users as $key => $user): ?>
    <tr>
        <td><?php echo $key+1; ?></td>
        <td><?php echo $this->Html->link($user['User']['username'],
				array('controller' => 'users', 'action' => 'view', $user['User']['id'])); ?>
        </td>
        <td><?php echo $user['User']['publish']; ?></td>
        <td><?php
			if($this->Session->read('Auth.User.role') === 'superadmin'):
		 		echo $this->Form->postLink('Delete',
					array('action' => 'delete', $user['User']['id']),
					array('confirm' => 'Are you sure?'));
			endif;
            ?>
            <?php echo $this->Html->link('Edit',
				array('controller' => 'users', 'action' => 'edit', $user['User']['id'])); ?>
        </td>
        <td><?php echo ucfirst($user['User']['role']); ?></td>
        <td><?php echo $user['User']['modified']; ?></td>
        <td><?php echo $user['User']['created']; ?></td>
    </tr>
    <?php endforeach; ?>
    <?php unset($user); ?>
</table>

Pages >> <?php echo $this->Paginator->numbers(array('first' => 'First page')); ?>
